<template>
  <DatePicker
    v-model="day"
    type="date"
    format="yyyy-MM-dd"
    @change="handleChangeDay"
    :multiple="multiple"
    placeholder="选择日期">
  </DatePicker>
</template>


<script>
import {mapActions} from "vuex"
export default {
  emits: ["handleInput"],
  props: {
    value: null,
    name: String,
    multiple: false
  },
  data() {
    return {
      day: '',
    };
  },
  mounted() {
    if (this.value) {
      this.day = this.value;
    }
  },
  watch: {
    value() {
      if (this.value) {
        this.day = this.value;
      }
    }
  },
  methods: {
    handleChangeDay(value) {
      this.$emit('handleInput', this.$formatYmd(value), this.name);
    },

  }
}
</script>
